dnl configure.ac based on the same from
dnl the "deskbar-applet" module

AC_INIT(chartr, 0.23, ga6ri3l@gmail.com)
AC_CONFIG_SRCDIR(src/__init__.py)
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_MACRO_DIR([m4])

AM_INIT_AUTOMAKE
GNOME_COMMON_INIT

AM_MAINTAINER_MODE
AM_DISABLE_STATIC
AM_PROG_LIBTOOL
AC_SUBST(ACLOCAL_AMFLAGS, "$ACLOCAL_FLAGS -I m4")
AC_PROG_CC

dnl ****************************************************************************
dnl * Pkg-Config
dnl ****************************************************************************
AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no)
if test "x$HAVE_PKGCONFIG" = "xno"; then
  AC_MSG_ERROR(you need to have pkgconfig installed !)
fi

dnl ****************************************************************************
dnl * Python 2.5
dnl ****************************************************************************
dnl AM_PATH_PYTHON(2.5)
AM_PATH_PYTHON([2.5])
PYTHON_PREFIX=`python -c "import sys; print sys.prefix"`
PYTHON_CFLAGS="-I$PYTHON_PREFIX/include/python$PYTHON_VERSION"
AC_CHECK_HEADER([$PYTHON_PREFIX/include/python$PYTHON_VERSION/Python.h],,
    AC_ERROR([Can't find Python.h! You will need the python development package
              to successfully compile gDesklets.]))
AC_SUBST(PYTHON_CFLAGS)

dnl ****************************************************************************
dnl * Write the values of various paths in defs.py
dnl ****************************************************************************
AC_SUBST(VERSION)
AC_SUBST(PACKAGE)

echo $datadir
echo $libdir
AS_AC_EXPAND(DATADIR, $datadir)
AC_SUBST(DATADIR)

AS_AC_EXPAND(LIBDIR, $libdir)
AC_SUBST(LIBDIR)

AS_AC_EXPAND(PYTHONDIR, $pythondir)
AC_SUBST(PYTHONDIR)

dnl ****************************************************************************
dnl * pkg-config checks for all the goodness
dnl ****************************************************************************
AC_SUBST(CHARTR_CFLAGS)
AC_SUBST(CHARTR_LIBS)


AC_MSG_CHECKING(for pygtk defs)
PYGTK_DEFSDIR=`$PKG_CONFIG --variable=defsdir python-gtk2`
AC_SUBST(PYGTK_DEFSDIR)
AC_MSG_RESULT($PYGTK_DEFSDIR)

AC_OUTPUT([
Makefile
src/Makefile
data/Makefile
doc/Makefile
])

echo
echo $PACKAGE v$VERSION
echo

echo Prefix............... : $prefix
echo data_dir............. : $datadir
